/*
 * @Author: huangtianyang 916072572@qq.com
 * @Date: 2023-01-13 10:31:02
 * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @LastEditTime: 2024-05-27 10:11:17
 * @FilePath: \report-h5\src\utils\config.ts
 */

//公众号id
export const appId = window.location.host.includes('report-h5.uat.szctjt.cn')
    ? 'wx5e532b806f7ad4e1'
    : 'wx47366f6e4875c1d1'
//产品类型
export const productTypeArray = [
    { label: '出险', value: '1' },
    { label: '维保', value: '2' },
    { label: '新能源', value: '3' }
]
//套餐名称
export const packageNameArray = [
    { label: 'A套餐', value: '1' },
    { label: 'B套餐', value: '2' },
    { label: 'C套餐', value: '3' },
    { label: 'D套餐', value: '4' },
    { label: 'E套餐', value: '5' },
    { label: 'F套餐', value: '6' }
]

export const packageNameMap = new Map()
packageNameArray.forEach(item => {
    packageNameMap.set(item.value, item.label)
})

export const productTypeMap = new Map()
productTypeArray.forEach(item => {
    productTypeMap.set(item.value, item.label)
})

//协议类型
export enum ProtocolType {
    USER_AGREEMENT = '用户协议',
    PRIVACY_AGREEMENT = '隐私政策',
    STORAGE_AGREEMENT = '储值协议',
    QUERY_GRANT_INFO = '报告说明',
    ABOUT_INFO = '关于我们',
    QUERY_AUTHORIZATION_INFO = '查询授权说明'
}

//钱包消费记录类型
export enum WALLET_RECORD_TYPE {
    CONSUME,
    PAY,
    REFUND
}

//查询报告类型
export enum QUERY_REPORT_TYPE {
    COLLISION = 1, //出险
    REPAIR = 2, //维修版
    ENERGY = 3 //新能源车况
}

//报告信息
export enum REPORT_CONFIG_INFO {
    manufacturers = '生产厂商',
    fuelType = '燃料类型',
    bodyColor = '车身颜色',
    brandname = '品牌名称',
    carcategory = '车型类别',
    classattribute = '国产/进口',
    ownerNumber = '车主任数',
    emissionStandard = '排放标准',
    registerDate = '初次登记日期',
    isBusiness = '是否有营业记录',
    isNoTown = '是否有非个人车主情况',
    productionDate = '生产日期',
    motortypecode = '车辆种类',
    ownertype = '当前车主类型',
    ratedpasscapa = '核定载客人数',
    replacementvalue = '新车购置价',
    properties = '当前使用性质',
    vehicledisplacement = '排量',
    vehicleengineno = '发动机号',
    vehiclestyle = '款型名称',
    cmidangtimes = '商业险出险次数',
    cpidangtimes = '交强险出险次数',
    inscompensation = '保险案件拒赔记录',
    isburned = '是否有过火烧',
    iscoverageMVL = '当前车损险保额',
    effectiveCmi = '当前商业险有效性',
    effectiveCpi = '当前交强险有效性',
    iseffectiveMVL = '当前机动车损失险有效性',
    iseffectiveTPL = '当前第三者责任险有效性',
    isrobber = '是否有过盗抢',
    isseriescoverCDR = '车损险连续性',
    seriesCoverCpi = '交强险连续性',
    iswaterflooded = '是否有过水淹',
    largeamount = '	最大损失金额',
    largeclaims = '大额理赔',
    recordIwriteoff = '保险案件未结案记录',
    recordicpending = '保险案件未结案记录',
    batteryEnergy = '电池能量(kWh)',
    batteryType = '电池类型',
    batteryWarranty = '电池组质保',
    biggestMileage = '续航里程',
    brand = '车辆品牌',
    brandLogo = '品牌图标',
    carSize = '长*宽*高（mm）',
    chargingTime = '充电时间',
    fastCharge = '快充电量(%)',
    levelId = 'level id',
    licensePlateColor = '车牌颜色', //1.绿牌；2.蓝牌；3.其他
    listingTime = '上市年月',
    modelDetail = '车型信息',
    models = '车型',
    motorNum = '驱动电机数',
    motorYype = '电机类型',
    powerConsumptionPer = '百公里耗电量(kWh/100km)',
    totalPower = '电动机总功率(kW)',
    transmissionType = '变速器',
    vehicleAttributes = '厂家类型（国产,合资,进口）',
    engineNo = '发动机号',
    issueCompany = '发证单位'
}

//保险信息
export enum INSURANCE_INFORMATION {
    effectiveCpi = '是否有有效交强险保单',
    effectiveCmi = '是否有有效商业险保单',
    seriesCoverCpi = '交强险是否连续投保',
    isseriescoverCDR = '车损险是否连续投保',
    isOutstandingCase = '是/否有未结案记录',
    isLogOut = '是/否有注销记录',
    isClaimsRejected = '是/否有拒赔记录'
}

//明细检查
export enum REPORT_DETAILED_CHECK {
    a = '地盘悬挂',
    b = '发动机',
    c = '附属配件',
    d = '骨架',
    e = '火烧',
    f = '气囊',
    g = '水淹',
    h = '外观',
    j = '加强件'
}
//电池静态数据
export enum BATTERY_STATIC_DATA {
    fullChargedDrivingMile = '参考续航里程',
    batteryManufacturer = '电池厂商',
    rateCapacity = '标称电池容量',
    packCode = '电池包编码',
    rateMileage = '标称续航里程',
    nominalEnergy = '系统标称能量',
    manufacturerDate = '生产日期'
}

//充放电数据
export enum CHARGE_DISCHARGE_DATA {
    firstChargeDate = '首次充电时间',
    latestChargeDate = '最后一次充电时间',
    totalChargeCount = '总充电次数',
    estimatedChargeCount = '估计的充电次数',
    totalChargeSoc = '总充电量以循环圈数累计',
    chaVoltDiffMean = '充电电芯平均压差',
    fastRatio = '快充占比',
    chaSocAvg = '次均充入量',
    chaMaxTempMean = '充电最高温度平均',
    chaMinTempMean = '充电最低温度平均',
    chaStartSoc = '充电最高频率下的起始SOC',
    chaEndSoc = '充电最高频率下的截止SOC'
}

//行驶数据
export enum RUN_DATA {
    firstDrivingDate = '首次行驶时间',
    firstOnlineDisplayMileage = '首次上线表显里程',
    fullChargedDrivingMile = '当前满电续驶里程',
    lastDrivingDate = '最近一次行驶时间',
    usageDate = '已使用时间',
    displayMileage = '表显行驶里程',
    yearAvgMileage = '年平均里程',
    averageDailyDriveHour = '日均行驶时长',
    averageDailyUseHour = '日均用车时长',
    powerConsumptionPer = '百公里耗电量',
    optimumTempPro = '舒适温度运行占比',
    driveStartSoc = '行车最高频率下的起始SOC',
    driveEndSoc = '行车最高频率下的截止SOC',
    driveMaxTempMean = '行驶最高温度平均',
    driveMinTempMean = '行驶最低温度平均',
    chaStartSoc = '充电截止温度（高频）'
}
//电池安全分析
export enum BATTERY_SAFE {
    abnormalA = '一级故障水平',
    abnormalB = '二级故障水平',
    abnormalC = '三级级故障水平',
    batteryThermalManage = '热管理水平',
    voltManage = '电压管理水平',
    powerManage = '电量管理水平',
    voltConsistManage = '电压一致性管理水平',
    insulateManage = '绝缘管理水平',
    dcdcManage = 'DC-DC管理水平',
    motorThermalManage = '电机热管理水平',
    otherManage = '其他管理水平'
}

//疑似行为检查
export enum SUSPECTED_BEHAVIOR {
    suspectedAdjust = '是否疑似调表',
    suspectedAdjustDate = '疑似调表时间',
    suspectedMileageAfterAdjust = '疑似调表后里程',
    suspectedMileageBeforeAdjust = '疑似调表前里程'
}

export const rule_1 = [
    { range: [90, 95], deduct: 2 },
    { range: [80, 90], deduct: 6 },
    { range: [65, 80], deduct: 12 },
    { range: { min: 65 }, deduct: 36 } //低于65分（不包含）
]

const rule_2 = [
    { range: [0.5, 1.5], deduct: 3 },
    { range: [1.5, 3], deduct: 6 },
    { range: { max: 3 }, deduct: 12 }
]

const rule_3 = [
    { range: [0.5, 1.5], deduct: 3 },
    { range: [1.5, 3], deduct: 12 },
    { range: { max: 3 }, deduct: 36 }
]
interface scoreParams {
    [propname: string]: any
}
// 新能源车况报告评分规则
export const SCORE_RULE: scoreParams = {
    //电池容量保持率
    volumeScore: rule_1,
    //内阻
    internalResistanceScore: rule_1,
    //自放电率
    selfDischargeRateScore: rule_1,
    //温度一致性
    temperatureConsistenceScore: rule_1,
    //电压一致性
    voltConsistenceScore: rule_1,
    //快充占比
    fastRatio: { max: 0.75, deduct: 6 },
    //次均充入SOC
    chaSocAvg: { min: 25, deduct: 3 },
    //充电最高频率下的起始 SOC
    chaStartSoc: { max: 70, deduct: 3 },
    //充电最高温度平均
    chaMaxTempMean: { max: 45, deduct: 6 },
    //充电最低温度平均
    chaMinTempMean: [
        { min: -5, deduct: 3 },
        { max: 30, deduct: 3 }
    ],
    //充电电芯平均压差
    chaVoltDiffMean: { max: 50, deduct: 12 },
    //行驶最高温度平均
    driveMaxTempMean: { max: 45, deduct: 6 },
    //行驶最低温度平均
    driveMinTempMean: [
        { min: -5, deduct: 3 },
        { max: 30, deduct: 3 }
    ],
    //行车最高频率下的截止SOC
    driveEndSoc: { min: 50, deduct: 3 },
    //舒适温度运行占比
    optimumTempPro: { min: 0.5, deduct: 6 },
    //一级故障水平
    abnormalA: [
        { range: [0.5, 1.5], deduct: 1 },
        { range: [1.5, 3], deduct: 3 },
        { range: { max: 3 }, deduct: 9 }
    ],
    //二级级故障水平
    abnormalB: rule_2,
    //三级级故障水平
    abnormalC: rule_3,
    //热管理水平
    batteryThermalManage: rule_2,
    //电压管理水平
    voltManage: rule_2,
    //电量管理水平
    powerManage: rule_2,
    //电压一致性管理水平
    voltConsistManage: rule_3,
    //绝缘管理水平
    insulateManage: rule_3,
    //DC-DC管理水平
    dcdcManage: rule_3,
    //电机热管理水平
    motorThermalManage: rule_3,
    //其他管理水平
    otherManage: rule_3
}
